<?php
$cs = Yii::app()->clientScript;
$script = <<<JS
$(function(){
    $('body').ajaxSend(function(){
        $.countAjaxRequest = $.countAjaxRequest == undefined ? 0 : $.countAjaxRequest;
        $.countAjaxRequest++;
        var loading = $(this).find('#AjaxLoading');
        loading.show();
    });
    $('body').ajaxComplete(function(e, xhr, settings){
        $.countAjaxRequest--;
        if ($(this).find('#AjaxLoading').length > 0) {
            if ($.countAjaxRequest == 0)
                $(this).find('#AjaxLoading').hide();
        }
    });
});
JS;
$cs->registerScript('ShowAjaxLoading', $script, CClientScript::POS_HEAD);
$popup = Yii::app()->request->getParam('layout', false) == 'popup';
if ($popup)
{
    $script = "
//console.log(jQuery.param.querystring);
jQuery('a').each(function(){
    var selected = jQuery(this);
    var href = selected.attr('href');
    if (/#/.test(href) == false && /javascript:/.test(href) == false && /layout=/.test(href) == false)
    {
        if (/\?/.test(href))
        {
            href += '&';
        }
        else
        {
            href += '?';
        }
        href += 'layout=popup';
        selected.attr('href', href);
    }
});
";
    $cs->registerScript('SubmitForm', $script);
//    $cs->registerCoreScript('bbq');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>
            CPanel | <?php echo Settings::SITE_NAME?>
        </title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="robots" content="noindex, nofollow" />
        <style type="text/css">
        /*<![CDATA[*/
                @import url("<?php echo Yii::app()->theme->baseUrl?>/styles/styles.css?1");
                @import url('<?php echo Yii::app()->theme->baseUrl?>/styles/general.css?1');
                @import url('<?php echo Yii::app()->theme->baseUrl?>/styles/tabmenu.css?1');
                @import url('<?php echo Yii::app()->theme->baseUrl?>/styles/dashboard.css?1');
        /*]]>*/
        </style>
        <link rel="SHORTCUT ICON" href="<?php echo Yii::app()->theme->baseUrl?>/images/favicon.ico" />

        <?php Yii::app()->ClientScript->registerCoreScript('jquery'); ?>
        <script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl?>/scripts/menudrop.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl?>/scripts/common.js"></script>
    </head>
    <body<?php echo $popup ? ' class ="popup"' : '';?>>
        <div id="AjaxLoading">
            <img src="<?php echo Yii::app()->theme->baseUrl;?>/images/ajax-loader.gif" />&nbsp; Loading... Please wait...
        </div>
        <?php if ($popup === false):?>
        <div class="Header">
            <div class="logo">
                <a href="#">Sites Administration</a>
            </div>
            <div class="textlinks">
                <div class="MenuText">
                    <a href="<?php echo $this->createUrl('/User/account/update',array('id' => Yii::app()->user->Id))?>" class="MenuText">My account</a>
                    <div id="mnuAddonsMenu" style="height: 53px; display: none;" class="DropShadowContainer">
                        <div class="Shadow1">
                            <div class="Shadow2">
                                <div class="Shadow3">
                                    <div class="ItemContainer">
                                        <div id="" class="DropDownMenu" style="width: 140px; position: static;">
                                            <ul>
                                                <li>
                                                    <a href="" class="MenuTextDrop" id=
                                                    "ViewAddonsLink" name="ViewAddonsLink">View Addons</a>
                                                </li>
                                                <li>
                                                    <a href="" class="MenuTextDrop" id=
                                                    "AddonSettingsLink" name="AddonSettingsLink">Addon Settings</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>|<a href="#" class="PopDownMenu MenuText" id="mnuUsersMenuButton" name="mnuUsersMenuButton">Users &amp; Permissions<img src=
                    "<?php echo Yii::app()->theme->baseUrl;?>/images/arrow_down_white-2.gif" border="0" /></a>
                    <div id="mnuUsersMenu" style="height: 53px; display: none;" class="DropShadowContainer">
                        <div class="Shadow1">
                            <div class="Shadow2">
                                <div class="Shadow3">
                                    <div class="ItemContainer">
                                        <div id="" class="DropDownMenu" style="width: 140px; position: static;">
                                            <ul>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/User/account/admin')?>" class="MenuTextDrop">User Accounts</a>
                                                </li>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/permission/index');?>" class="MenuTextDrop">Permissions</a>
                                                </li>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/permission/role');?>" class="MenuTextDrop">Manage Roles</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>|<a href="#" class="PopDownMenu MenuText" id="mnuToolsMenuButton" name="mnuToolsMenuButton">Tools<img src=
                    "<?php echo Yii::app()->theme->baseUrl;?>/images/arrow_down_white-2.gif" border="0" /></a>
                    <div id="mnuToolsMenu" style="height: 144px; display: none;" class="DropShadowContainer">
                        <div class="Shadow1">
                            <div class="Shadow2">
                                <div class="Shadow3">
                                    <div class="ItemContainer">
                                        <div id="" class="DropDownMenu" style="width: 140px; position: static;">
                                            <ul>
                                                <li>
                                                    <a href="<?php echo  $this->createUrl('/Admin/tools/fileManager'); ?>" class="MenuTextDrop">File manager</a>
                                                </li>
                                                <li>
                                                    <a href="<?php echo  $this->createUrl('/Admin/tools/rebuildCache'); ?>" >Rebuild cache</a>
                                                </li>
                                                <li class="Break"><hr /></li>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/gii')?>" target="_blank" class="MenuTextDrop">Code generator (Gii)</a>
                                                </li>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/tools/resetSequences')?>" target="_blank" class="MenuTextDrop">Reset Database Sequences</a>
                                                </li>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/tools/manageTemplates')?>" class="MenuTextDrop">Manage Email messages</a>
                                                </li>
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/setting/admin')?>" class="MenuTextDrop">Manage parameters</a>
                                                </li>
                                                <li class="Break"><hr /></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>|<a href="#" class="PopDownMenu MenuText" id="mnuSettingsMenuButton" name="mnuSettingsMenuButton">Settings<img src=
                    "<?php echo Yii::app()->theme->baseUrl;?>/images/arrow_down_white-2.gif" border="0" /></a>
                    <div id="mnuSettingsMenu" style="height: 411px; display: none;" class="DropShadowContainer">
                        <div class="Shadow1">
                            <div class="Shadow2">
                                <div class="Shadow3">
                                    <div class="ItemContainer">
                                        <div id="" class="DropDownMenu" style="width: 140px; position: static;">
                                            <ul>
                                                <!--<li>
                                                    <a href="<?php echo $this->createUrl('/Admin/lookup')?>" class="MenuTextDrop">Lookup lists</a>
                                                </li>-->
                                                
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/term/index')?>" class="MenuTextDrop">Categorization</a>
                                                </li>
                                                
                                                <li>
                                                    <a href="<?php echo $this->createUrl('/Admin/setting')?>" class="MenuTextDrop">Parameters</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>|<a href="#" class="PopDownMenu MenuText Last" id="mnuSitesMenuButton" name="mnuSitesMenuButton">View Site<img src=
                    "<?php echo Yii::app()->theme->baseUrl;?>/images/arrow_down_white-2.gif" border="0" /></a>
                    <div id="mnuSitesMenu" style="height: 411px; display: none;" class="DropShadowContainer">
                        <div class="Shadow1">
                            <div class="Shadow2">
                                <div class="Shadow3">
                                    <div class="ItemContainer">
                                        <div id="" class="DropDownMenu" style="width: 140px; position: static;">
                                            <?php $this->widget('application.modules.Cms.components.SiteLinks');?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="menuBar">
            <div class="ControlPanelSearchBar">
                <?php //$this->widget('Admin.components.SiteDropDownList');?>
            </div>
            <div id="Menu">
                <?php $this->widget('Admin.components.ModuleMenus'); ?>
            </div>
        </div>
        <?php endif;?>
        
        <div class="ContentContainer">
            <?php if ($popup === false):?>
                <?php if (!empty($this->breadcrumbs)):?>
                    <div class="HeaderContainer">
                    <?php $this->widget('zii.widgets.CBreadcrumbs', array(
                        'links'=>$this->breadcrumbs,
                        'htmlOptions'=>array(
                            'id' => 'PageBreadcrumb',
                            'class' => 'Breadcrumb',
                        ),
                        'separator' => "",
                        'homeLink' => CHtml::link('Home',array('/Admin')),
                    )); ?>
                    <?php $this->widget('Admin.components.GotoMenu');?>
                    <script type="text/javascript">
                    //<![CDATA[
                    //<!--
                    // not in DOM ready, we want this to happen ASAP so the user doesn't see a colour flicker
                    $('#PageBreadcrumb a:first').addClass('Home');
                    $('#PageBreadcrumb span').prev('a').addClass('SecondLast');
                    //-->
                    //]]>
                    </script>
                    </div>
                <?php endif;?>
            <?php endif;?>
            <div class="BodyContainer" style="margin-top: 0pt;">
                <?php
                $this->widget('MessageBox');    
                echo $content
                ?>
            </div>
        </div>
        <?php if ($popup === false):?>
        <div class="PageFooter" style="text-align: center;">Copyright &copy; 2011 by Tagrem Technology.<br /> All Rights Reserved.</div>
        <?php endif;?>
    </body>
</html>
